home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
351-375
/
disk_370
/
sksh
/
diffs.doc
< prev
next >
Wrap
Text File
|
1992-05-06
|
6KB
|
265 lines
SKsh/ksh Differences
SKsh
A ksh-like Shell for the Amiga
Version 1.5
(Copyright) 1989, 1990
Steve Koren
July 20, 1990
Introduction
This document describes some of the differences between SKsh
and ksh under Unix. It does not even begin to cover them all.
If you need to have specific information, compare the appro-
priate sections of the two manuals.
In general, scripts may be written which run under either SKsh
or ksh by testing the $SHELL parameter:
if [ "$SHELL" = 'sksh' ]
then
echo 'do some SKsh/AmigaDos specific things here'
elif [ "$SHELL" = '/bin/ksh' ]
then
echo 'do some ksh/UNIX specific things here'
fi
Differences List
Alias and Function Resolution
SKsh resolves alias and function names when they are logi-
cally encountered. ksh resolves them when they are physi-
cally encountered. This leads to different behaviours in
functions. For example, in SKsh, you can define a function
that uses an alias that you define after the function. As
long as the alias is defined before the function is ex-
ecuted (but not necessarily before it is defined), SKsh
will execute the alias normally. In ksh, on the other
hand, the alias must be defined as such when the function
is defined, not when it is executed.
Assignment Syntax
SKsh permits spaces to surround the '=' in an assignment
statement. ksh does not.
${var:val} Operations
ksh has a bunch of variable binding operators that look
like the above, and permit tests and assignments to be made
in one step. SKsh does not support any of these.
SKSH Amiga Shell Page 2 SKsh/ksh Differences
vi mode
ksh has a command line editing mode that is similar to vi
bindings. SKsh provides user definable editing and two
functions which define editing styles similar to emacs and
vi. A few of the commands, such as the ^r history search,
work slightly differently than they do in the Un*x ksh.
In-line parameter assignment
ksh permits variables to be assigned to while being used as
a parameter. For example,
export COLUMNS=80
SKsh does not permit this. You must perform the assignment
and export separately.
Job Control
ksh has job control. SKsh does not.
Path Separator Character
ksh uses ':' as a path separator character. Since the co-
lon is a legal character in AmigaDos path names, a comma is
used instead.
Function Definition Syntax
The SKsh function definition syntax using the 'function'
keyword is compatible with ksh, but ksh also permits an al-
ternate syntax using 'function() { }' that SKsh does not.
Set vs. Options
ksh uses the 'set' keyword to set options to the shell
itself. SKsh uses 'set' to list alias, variables, and
functions. SKsh uses the 'option' command to set shell
options. These options are, with only a few exceptions,
different from their ksh counterparts.
SKSH Amiga Shell Page 3 SKsh/ksh Differences
Scoping Rules
The SKsh scoping rules are different than the scoping rules
in in ksh. Ksh supports the 'typeset' keyword to create
local variables; SKsh controls this with an option flag and
the 'local' command. In addition, SKsh local variables can
be turned off entirely to emulate the sh scoping rules.
Builtin Commands
SKsh accomplishes many things with builtin commands that
ksh accomplishes with external binaries. In addition, Unix
has boatloads more of these commands than the Amiga and
SKsh combined do or ever will. If its on Unix, and not on
AmigaDos, you'll probably have to write it if you want it.
In addition, many of the SKsh commands accept different pa-
rameters than either Unix counterparts with the same name.
Some of them also act differently; for example, 'read' in
Unix reads a single parameter separated by IFS, while
'read' in SKsh reads a whole line.
until...do...done statement
SKsh does not support this construct. I was not in a big
hurry to add it, since it is simply a while..do..done
statement with the test automatically inverted.
Parameter Breaks
SKsh breaks parameters in different places than ksh. For
example, 'foo'$foo is one parameter in ksh, but two in
SKsh. To make it one in SKsh, use double quotes around the
whole expression: "foo$foo", or use $(concat "foo" "$foo").
Standard Error Redirection
Under AmigaDos, there is no distinction between standard
output and standard error. Thus, you cannot redirect them
independently in SKsh.